package com.example.designpattenexample.visitor;

import java.util.Vector;

public class Test {
    public static void main(String[] args) {
        ObjectStructure objectStructure = new ObjectStructure();
        Vector<Element> elements = objectStructure.createElements();
        ConcreteVisitor visitor = new ConcreteVisitor();
        objectStructure.action(visitor);
        System.out.println("==================================");
        for (Element e : elements){
            if (e instanceof Element1)
                ((Element1) e).operation();
            else if (e instanceof Element2)
                ((Element2) e).operation();
        }
    }
}
